//
//  CommandManager.h
//  Command
//
//  Created by Hechun on 2020/11/7.
//

#import <Foundation/Foundation.h>

#import "Command.h"

NS_ASSUME_NONNULL_BEGIN

@protocol CommandManagerDelegate <NSObject, CommandDelegate>

@optional
- (void)commandManagerAction;

@end

@interface CommandManager : NSObject

/// 命令管理容器
@property (nonatomic, strong) NSMutableArray <Command*> *arrayCommands;

@property (nonatomic, weak) id<CommandManagerDelegate> delegate;

+ (instancetype)sharedInstance;
+ (instancetype)synchronizedManager;
+ (instancetype)semaphoreManager;

/// 执行命令
+ (void)executeCommand:(Command *)cmd completion:(CommandCompletionCallBack)completion;

/// 取消命令
+ (void)cancelCommand:(Command *)cmd;

@end

NS_ASSUME_NONNULL_END
